//
//  YAYIChoseHospitalListCell.m
//  yayi-医生版
//
//  Created by Veer on 16/4/25.
//  Copyright © 2016年 Veer. All rights reserved.
//

#import "YAYIChoseHospitalListCell.h"
#import "YAYIChoseHospitalListModel.h"

@interface YAYIChoseHospitalListCell()

@property (nonatomic, weak) UILabel *nameLbl;
@property (nonatomic, weak) UILabel *locationLbl;

@end

@implementation YAYIChoseHospitalListCell

- (void)setItem:(YAYIChoseHospitalListModel *)item
{
    _item = item;
    
    self.nameLbl.text = item.name;
    self.locationLbl.text = [NSString stringWithFormat:@"地址：%@", item.address];
}

+ (instancetype)cellWith:(UITableView *)tablevie
{
    static NSString *cellID = @"choseHospitalListCell";
    
    YAYIChoseHospitalListCell *cell = [tablevie dequeueReusableCellWithIdentifier:cellID];
    
    if (nil == cell) {
        cell = [[YAYIChoseHospitalListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setupSubView];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    //self.lineView.frame = CGRectMake(0, self.contentView.frame.size.height, SCREEN_width, 1);
    
    [self.nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(7));
        make.left.equalTo(@(15));
    }];
    
    [self.locationLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView).offset(-7);
        make.left.equalTo(@(15));
    }];
    
    
}


- (void)setupSubView
{
    
    // 医院名
    UILabel *nameLbl = [[UILabel alloc] init];
    nameLbl.text = @"杭州市口腔医院";
    nameLbl.font = [UIFont systemFontOfSize:16];
    nameLbl.textColor = YAYIColor(93, 90, 93);
    [self.contentView addSubview:nameLbl];
    self.nameLbl = nameLbl;
    
    // 位置
    UILabel *locationLbl = [[UILabel alloc] init];
    locationLbl.text = @"地址：杭州市平海路1号";
    locationLbl.font = [UIFont systemFontOfSize:13];
    locationLbl.textColor = YAYIColor(153, 150, 154);
    [self.contentView addSubview:locationLbl];
    self.locationLbl = locationLbl;
    
    // 线
}

@end
